﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using KaraokeManagementBUS;
using KaraokeManagementDTO;

namespace KaraokeManagement
{
    public partial class frmChonKhachHang : DevComponents.DotNetBar.Office2007Form
    {

        public static int staticMaKhachHang = -1;
        public frmChonKhachHang()
        {
            InitializeComponent();
        }

        private void frmChonKhachHang_Load(object sender, EventArgs e)
        {
            dgvDanhSachKhachHang.AutoGenerateColumns = false;
            initLoaiKhachHang();
            loadDanhSachKhachHang();
        }

        public void loadDanhSachKhachHang()
        {
            //dgvDanhSachKhachHang.Rows.Clear();
            dgvDanhSachKhachHang.DataSource = new KhachHangBUS().layDanhSachKhachHang();
        }

        private void btnChon_Click(object sender, EventArgs e)
        {
            if (dgvDanhSachKhachHang.Rows.Count > 0)
            {
                staticMaKhachHang = int.Parse(dgvDanhSachKhachHang.SelectedRows[0].Cells["ID"].Value.ToString());
                this.Close();
            }
        }

        public void initLoaiKhachHang()
        {
            cbLoaiKhachHang.DataSource = new LoaiKhachHangBUS().layDanhSachLoaiKhachHang();
            cbLoaiKhachHang.DisplayMember = "TenLoaiKhachHang";
            cbLoaiKhachHang.ValueMember = "ID";
        }

        
    }
}
